﻿using System;
using System.Web.UI;
using Solution.BusinessObject;

namespace Solution.Controls
{
    public partial class RelatedContent : UserControl
    {
        /// <summary>
        /// Gets or sets category of this contents.
        /// </summary>
        public Category Category { get; set; }

        /// <summary>
        /// Gets or sets Id of content that this contents is related to.
        /// </summary>
        public Content ContentRelated { get; set; }

        public RelatedContent(){}

        /// <summary>
        /// Constructor
        /// </summary>
        public RelatedContent(Category category, Content contentRelated)
        {
            this.Category = category;
            this.ContentRelated = contentRelated;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            // Populate data
            rptRelatedContent.DataSource = new ContentBO().GetOldRelatedContents(this.Category,
                                                                                 ContentRelated );
            rptRelatedContent.DataBind();
        }
    }
}
